package com.jt.demo3.aop;

import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class ExceptionAspect {
    @Pointcut("execution(* com.jt.demo3.service..*.*(..))")
    public void pointCut() {

    }

    @AfterThrowing(value = "pointCut()", throwing = "e")
    public void afterThrowing(Exception e) {
        System.out.println("打印异常信息:" + e.getMessage());
    }
}
